package net.nahiyak.springboot;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by nahiya on 2014-12-04.
 */
@RestController
@EnableConfigurationProperties(ConnectionSettings.class)
public class SampleController {

    @Value("${name}")
    private String name;

    @Autowired
    private ConnectionSettings connectionSettings;

    @RequestMapping("/")
    String home() {
        System.out.println(connectionSettings.getUsername());
        System.out.println(connectionSettings.getRemoteAddress());

        return name + " Hello World!";
    }
}
